package io._520;

import java.io.*;
import java.util.Scanner;

//简易记事本
public class Test {
    public static void main(String[] args) throws IOException {
        Scanner scan=new Scanner(System.in);
        System.out.println("请输入文件名：");
        String name=scan.nextLine();
        FileOutputStream fos=new FileOutputStream(name,true);
        OutputStreamWriter osw=new OutputStreamWriter(fos);
        BufferedWriter bw=new BufferedWriter(osw);
        while(true){
            System.out.println("请输入内容：");
            String con = scan.nextLine();
            if("exit".equals(con)){
                break;
            }
            PrintWriter pw=new PrintWriter(bw,true);
            pw.println(con);
        }
        System.out.println("保存成功");
        bw.close();
    }
}
